<?php
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('speech-grid', {
		data: $(this).serialize()
	});
	return false;
});
$('.create-button').click(function(){
	$('#speech_dialog').dialog('open');
	return false;
});
$('.create-form form').submit(function(){
	
	return false;
});
");
?>

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('/speech/_search',array(
	'model'=>$model,
)); ?>
</div>
<br />
<?php echo CHtml::link('Create Speech','#',array('class'=>'create-button')); ?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'speech-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		array(
			'header'=>'Speech_ID',
			'name'=>'sid',
			'value'=>'sid',
		),
		array(
			'header'=>'Speech_Name',
			'name'=>'speech',
			'value'=>'speech',
		),
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>

<?
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
    'id'=>'speech_dialog',
    // additional javascript options for the dialog plugin
    'options'=>array(
        'title'=>'Create Speech',
        'autoOpen'=>false,
    ),
));
$this->renderPartial('/speech/_form', array('model'=>$model));
$this->endWidget('zii.widgets.jui.CJuiDialog');
?>